package com.linsir.core.dict;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.linsir.common.Easy;
import com.linsir.common.base.BaseController;
import com.linsir.common.utils.xx;

/**
 * @author linsir
 * @title: DictController
 * @projectName linsir-mu
 * @description: 字典管理
 * @date 2021/12/2 23:55
 */
public class DictController extends BaseController {
    // 复制字典
    public void copy() {
        String id = getSelectValue("id");

        String dictTable = xx.getConfig("main_dict_table");

        Record r = Db.use(xx.DS_MAIN).findById(dictTable, id);
        r.remove("id");
        Db.use(xx.DS_MAIN).save(dictTable, r);

        renderJson(new Easy());
    }
}
